/*
 * VisionToMotors.h
 *
 *  Created on: Aug 5, 2014
 *      Author: unicorn
 */

#ifndef VISIONTOMOTORS_H_
#define VISIONTOMOTORS_H_

#include <iostream>
#include <cstring>      // Needed for memset
#include <sys/socket.h> // Needed for the socket functions
#include <netdb.h>      // Needed for the socket functions

#include <vector>

#define VISIONTOMOTORS_WORD	1
#define VISIONTOMOTORS_BYTE	0

#define TORQUE_ENABLE                   24
#define MOVING_SPEED                    32
#define GOAL_ACCELERATION               73
#define PRESENT_LOAD                    40
#define CW_LIMIT                        6
#define CCW_LIMIT                       8


#define DEFAULT_MOVING_SPEED   			50
#define DEFAULT_ACCELERATION   			15
#define LOW_ACCELERATION                15
#define GOAL_POSITION                   30
#define PRESENT_POSITION                36
#define RETURN_DELAY_TIME               5
#define STATUS_RETURN_LEVEL             16
#define DEFAULT_MAX_TORQUE              1023
#define MAX_TORQUE                      34


#define M23_CW  635
#define M23_CCW 3360

#define M24_CW  481
#define M24_CCW 1063

#define DEGREES_PER_POSITION	0.08789

namespace visiontomotors {
//class VisionToMotors {
//private:

//public:
bool initClient();

void closeClient();

int moveHead(int direction, int speed);

double getHeadAngle();

double getHeadDownAngle();

bool headLeftRightIsMoving();

bool headUpDownIsMoving();

void stopHead();

int readMotorPosition(int);

//};

} /* namespace visiontomotors */

#endif /* VISIONTOMOTORS_H_ */
